﻿Imports System.Data.SqlClient
Public Class saleReport
    Dim cmd As New SqlCommand
    Public Sub refreshdata()
        condb()
        grdsall.Rows.Clear()
        cmd.Connection = cn
        cmd.CommandText = "select tblorder . InvoiceID ,orderDate , proName,Qty,SUM(Qty) from tblorderDetial inner join tblorder ON tblorderDetial.InvoiceID = tblorder.InvoiceID where tblorder .orderDate between '" & startdate.Value & "' and '" & enddate.Value & "' and tblorderDetial .ProName like N'%" & txtsearch.Text & "%' group by tblorder . InvoiceID ,orderDate , proName,Qty"
        Dim rd = cmd.ExecuteReader
        While rd.Read = True
            grdsall.Rows.Add(rd(0), rd(1), rd(2), rd(3))
        End While   
        rd.Close()
        Dim p As Integer
        p = 0
        For i As Integer = 0 To Me.grdsall.Rows.Count - 1
            p = p + Me.grdsall.Rows(i).Cells(3).Value
        Next
        lbltotalamount.Text = p
    End Sub

    Private Sub txtsearch_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtsearch.TextChanged
        refreshdata()
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
      
    End Sub
End Class